package components
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.html.HTMLLoader;
	import flash.net.URLRequest;
	import mx.core.UIComponent;
	import mx.events.ResizeEvent;
	
	import nl.wv.extenders.panel.SuperPanel;
	
	public class loadPdfPage extends Sprite
	{
		public var panel:SuperPanel;
		public var webPage:HTMLLoader;
		
		public function loadPdfPage(p:SuperPanel)
		{
			panel = new SuperPanel();
			panel = p;
		}
		
		public function loadPDF(link:String):void{
			var request:URLRequest = new URLRequest(link);
			webPage = new HTMLLoader();
			webPage.load(request);
	 		webPage.x=10;
	 		webPage.y=24;
	 		webPage.height=panel.height-39;
	 		webPage.width=panel.width-35;
	 		var holder:UIComponent = new UIComponent();
			holder.addChild(webPage);
			panel.addChild(holder);
	 		webPage.addEventListener(Event.COMPLETE, webPageLoaded);
	 		panel.addEventListener(ResizeEvent.RESIZE, onResize);
	 	}
	 	
	 	public function onResize(e:Event):void{
	 		webPage.height=panel.height-39;
	 		webPage.width=panel.width-35;
	 	}
	 	
	 	public function webPageLoaded(e:Event):void{
	 	}
	}
}